<?php

namespace App\Http\Requests\Wechat;

use App\Http\Requests\ApiRequest;
use App\Models\Panx\Sex;
use App\Models\Panx\SkinDetector;
use Illuminate\Validation\Rule;

/**
 * @property string skin_record_id
 * @property string skin_detector_id
 * @property string type_skin_record_id
 * @property string openid
 * @property string sex
 */
class RecommendProductV3IndexRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'skin_detector_id'    => ['required', 'int', Rule::In(SkinDetector::validatedIds())],
            'type_skin_record_id' => 'required|int|min:1',
            'skin_record_id'      => 'required|int|min:1',
            'sex'                 => ['sometimes', 'required', Rule::In(Sex::allSex())],
        ];
    }
}
